<?php        
    class TemplateModel extends Model {
        public static $classDesc = "Template";
        
        public static $keyDesc = array(
            "id"            => "ID",
            "hashid"        => "Hashid",
            "userid"        => "User ID",
            "from_userid"   => "From user ID",
            "extratext"     => "Name/desc",
            "accepted"      => "Accepted",
            "updated"       => "Updated",
            "rowstamp"      => "Created"
        );
        
        public function __construct($id = null) {                                    
            $this->_childClass["template_exercise"] = "TemplateExerciseModel";
            $this->_childClass["template_record"]   = "TemplateRecordModel";
            
            $this->_childs["template_exercise"] = null;
            $this->_childs["template_record"]   = null;
            
            $this->_foreignIdCol    = "templateid";
            $this->_table           = "template";
            
            parent::__construct($id);
            
            # Tekstikenttien minimipituus
            parent::$_schema["template"]["extratext"]["minlength"] = 1;
        }
    }